<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
  <script src="./js/react.development.js"></script>
  <script src="./js/react-dom.development.js"></script>
  <script src="./js/babel.min.js"></script>
</head>

<body>
  <div id="app"></div>
  <script type="text/babel">
    let key1 = ""
    function showData(key) {
      // console.log(key);
      key1 = key
      // console.log(vdom);
      vdom =
        <div>
          <button onClick={() => { showData(1) }}>111</button>
          <button onClick={() => { showData(2) }}>222</button>
          <button onClick={() => { showData(3) }}>333</button>
          <p>{key1}</p>
        </div>
      // return key
      root.render(vdom)
    }
    // console.log(key);
    // let res = showData()
    let vdom =
      <div>
        <button onClick={() => { showData(1) }}>111</button>
        <button onClick={() => { showData(2) }}>222</button>
        <button onClick={() => { showData(3) }}>333</button>
        <p>{key1}</p>
      </div>
    let root = ReactDOM.createRoot(document.querySelector("#app"))
    root.render(vdom)

  </script>
</body>

</html>